<template>
	<view class="diy-group">
		<view v-for="(item, index) in diyData.value" :key="index">
			<template v-if="item.type == 'TEXT'">
				<!-- 文本 -->
				<diy-text :value="item"></diy-text>
			</template>
						
			<template v-if="item.type == 'TEXT_NAV'">
				<!-- 文本导航 -->
				<diy-text-nav :value="item"></diy-text-nav>
			</template>
						
			<template v-if="item.type == 'NOTICE'">
				<!-- 公告 -->
				<diy-notice :value="item" :site-id="siteId"></diy-notice>
			</template>
						
			<template v-if="item.type == 'GRAPHIC_NAV'">
				<!-- 图文导航 -->
				<diy-graphic-nav :value="item"></diy-graphic-nav>
			</template>
						
			<template v-if="item.type == 'IMAGE_ADS'">
				<!-- 图片广告 -->
				<diy-img-ads :value="item"></diy-img-ads>
			</template>
						
			<template v-if="item.type == 'SEARCH'">
				<!-- 搜索 -->
				<diy-search :value="item" :site-id="siteId" :city="city"></diy-search>
			</template>
						
			<template v-if="item.type == 'TITLE'">
				<!-- 顶部标题 -->
				<diy-title :value="item"></diy-title>
			</template>
						
			<template v-if="item.type == 'RICH_TEXT'">
				<!-- 富文本 -->
				<diy-rich-text :value="item"></diy-rich-text>
			</template>
						
			<template v-if="item.type == 'HORZ_LINE'">
				<!-- 辅助线 -->
				<diy-horz-line :value="item"></diy-horz-line>
			</template>
						
			<template v-if="item.type == 'HORZ_BLANK'">
				<!-- 辅助空白 -->
				<diy-horz-blank :value="item"></diy-horz-blank>
			</template>
						
			<!-- v-if="item.type == 'AdminPlatformcoupon' && addonIsExit.coupon" -->
		<!-- 	<template v-if="item.type == 'AdminCoupon' && addonIsExit.coupon"> -->
			<template v-if="item.type == 'ADMIN_PLATFORM_COUPON' && addonIsExit.platformcoupon">
				<!-- 优惠券 -->
				<diy-coupon :value="item"></diy-coupon>
			</template>
			
			<template v-if="item.type == 'BARGAIN_LIST' && addonIsExit.bargain">
				<!-- 砍价 -->
				<diy-bargain :value="item" :site-id="siteId"></diy-bargain>
			</template>
						
			<template v-if="item.type == 'GOODS_LIST'">
				<!-- 商品列表 -->
				<diy-goods-list :value="item" :site-id="siteId" :root="root"></diy-goods-list>
			</template>
						
			<template v-if="item.type == 'RUBIK_CUBE'">
				<!-- 魔方、橱窗 -->
				<diy-rubik-cube :value="item"></diy-rubik-cube>
			</template>
						
			<template v-if="item.type == 'VIDEO'">
				<!-- 视频 -->
				<diy-video :value="item"></diy-video>
			</template>
						
			<template v-if="item.type == 'SECKILL_LIST' && addonIsExit.seckill">
				<!-- 秒杀 -->
				<diy-seckill :value="item" :site-id="siteId"></diy-seckill>
			</template>
						
			<template v-if="item.type == 'PLATFORM_PINTUAN_LIST' && addonIsExit.pintuan">
				<!-- 拼团 -->
				<diy-pintuan :value="item" :site-id="siteId"></diy-pintuan>
			</template>
						
			<template v-if="item.type == 'GROUPBUY_LIST' && addonIsExit.groupbuy">
				<!-- 团购 -->
				<diy-groupbuy :value="item" :site-id="siteId"></diy-groupbuy>
			</template>
						
			<template v-if="item.type == 'GOODS_CATEGORY'">
				<!-- 商品分类 -->
				<diy-goods-level-category :value="item" :bottom="scrollHeight" :site-id="siteId"></diy-goods-level-category>
			</template>
			<template v-if="item.type == 'WHOLESALE_LIST' && addonIsExit.wholesale">
				<!-- 批发 -->
				<diy-whole-sale :value="item" :site-id="siteId"></diy-whole-sale>
			</template>
			<template v-if="item.type == 'WEAPP_LIVE'">
				<!-- 小程序直播 -->
				<!-- #ifdef MP-WEIXIN -->
				<diy-live :value="item" :site-id="siteId"></diy-live>
				<!-- #endif -->
			</template>
			
			<template v-if="item.type == 'SHOP_INFO' && siteId">
				<!-- 店铺信息 -->
				<diy-shop-info :value="item" :site-id="siteId" :type="1"></diy-shop-info>
			</template>
			
			<template v-if="item.type == 'SHOP_SEARCH' && siteId">
				<!-- 店内搜索 -->
				<diy-shop-search :value="item" :site-id="siteId"></diy-shop-search>
			</template>
			
			<template v-if="item.type == 'RANK_LIST' && siteId">
				<!-- 店铺排行榜 -->
				<diy-shop-rank-list :value="item" :site-id="siteId"></diy-shop-rank-list>
			</template>
			
			<template v-if="item.type == 'SHOP_STORE' && siteId">
				<!-- 门店列表 -->
				<diy-shop-store :value="item" :site-id="siteId"></diy-shop-store>
			</template>
			<template v-if="item.type == 'FLOAT_BTN'">
				<!-- 门店列表 -->
				<diy-float :value="item"></diy-float>
			</template>
			<template v-if="item.type == 'CORPORATE_SUBSCRIPTION_GOODS_LIST'">
				<!-- 企业认购商品列表 -->
				<diy-corporate-goods-list :value="item" :site-id="siteId" :root="root"></diy-corporate-goods-list>
			</template>
			
			<template v-if="item.type == 'NEWUSER_COUPON_GOODS_LIST'">
				<!-- 新人专享商品列表 -->
				<diy-newuser-coupon-goods-list  :value="item" :site-id="siteId" :root="root"></diy-newuser-coupon-goods-list>
			</template>
			
			<template v-if="item.type == 'TOPIC_ACTIVITY'">
				<!--活动商品列表 -->
				<diy-goods-activity-list :value="item"></diy-goods-activity-list>
			</template>
			
		</view>
		<view class="blockView" style="display: none;">
			
		</view>
	</view>
</template>

<script>
import diyFloat from '@/components/diy-float/diy-float';
import diyHorzBlank from '@/components/diy-horz-blank/diy-horz-blank.vue';
import diyHorzLine from '@/components/diy-horz-line/diy-horz-line.vue';
import diyCoupon from '@/components/diy-coupon/diy-coupon.vue';
import diyGoodsList from '@/components/diy-goods-list/diy-goods-list.vue';
import diyImgAds from '@/components/diy-img-ads/diy-img-ads.vue';
import diyGraphicNav from '@/components/diy-graphic-nav/diy-graphic-nav.vue';
import diyNotice from '@/components/diy-notice/diy-notice.vue';
import diyRichText from '@/components/diy-rich-text/diy-rich-text.vue';
import diyRubikCube from '@/components/diy-rubik-cube/diy-rubik-cube';
import diySearch from '@/components/diy-search/diy-search.vue';
import diyTextNav from '@/components/diy-text-nav/diy-text-nav.vue';
import diyTitle from '@/components/diy-title/diy-title.vue';
import diyVideo from '@/components/diy-video/diy-video.vue';
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import diySeckill from '@/components/diy-seckill/diy-seckill.vue';
import diyBargain from '@/components/diy-bargain/diy-bargain.vue';
import diyPintuan from '@/components/diy-pintuan/diy-pintuan.vue';
import diyGroupBuy from '@/components/diy-groupbuy/diy-groupbuy.vue';
import diyGoodsLevelCategory from '@/components/diy-goods-level-category/diy-goods-level-category.vue';
import diyLive from '@/components/diy-live/diy-live.vue';
import diyWholeSale from '@/components/diy-wholesale/diy-wholesale.vue'
import globalConfig from '@/common/js/golbalConfig.js'
import diyCorporateGoodsList from '@/components/diy-corporate-goods-list/div-corporate-goods-list.vue';
import diyNewuserCouponGoodsList from '@/components/diy-goods-list/diy-newuser-coupon-goods-list.vue';
import diyGoodsActivityList from '@/components/diy-goods-list/diy-goods-activity-list.vue';

export default {
	components: {
		diyHorzBlank,
		diyHorzLine,
		diyCoupon,
		diyGoodsList,
		diyImgAds,
		diyGraphicNav,
		diyNotice,
		diyRichText,
		diyRubikCube,
		diySearch,
		diyTextNav,
		diyTitle,
		diyVideo,
		diyBargain,
		uniPopup,
		diySeckill,
		diyPintuan,
		diyGroupBuy,
		diyGoodsLevelCategory,
		diyLive,
		diyWholeSale,
		diyFloat,
		diyCorporateGoodsList,
		diyNewuserCouponGoodsList,
		diyGoodsActivityList,
	},
	props: {
		diyData: {
			type: [Array,Object]
		},
		siteId:{
			type:[String,Number],
			default: 0
		},
		height:{
			type:String,
			default(){
				return "100vh"
			}
		},
		scrollHeight:{
			type:String,
			default(){
				return "100vh"
			}
		},
		city:{
			type:String,
		},
		//引用组件页面
		root:{
			type:String,
		},
	},
	data() {
		return {
			showStore:false
		};
	},
	mounted(){
		console.log("打印",this.diyData)
	},
	mixins:[globalConfig],
	computed: {
		bgColor(){
			let str="";
			if(this.diyData && this.diyData.global){
				str=this.diyData.global.bgColor;
			}
			return str;
		},
		bgUrl(){
			let str="";
			if(this.diyData&& this.diyData.global){
				str=this.diyData.global.bgUrl;
			}
			return str;
		},
		bgNav() {
			if (this.bgUrl) {
				return { background: 'url(' + this.$util.img(this.bgUrl) + ') no-repeat 0 0/100%' };
			} else if (this.bgColor) {
				return { background: this.bgColor };
			} else {
				return { background: '#ffffff' };
			}
		}
	}
};
</script>

<style lang="scss">
	.diy-group{
		width: 100%;
		height: 100%;
	}
	.blockView{
		width: 100%;
		height: 30px;
	}
</style>
